﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DTO_QLNS;

namespace ADO_QLNS
{
    public class PublisherADO : QLNS_ADO
    {
        PublisherDTO _PublisherDTO;

        public override string InsertString(TransferObject dto)
        {
            _PublisherDTO = (PublisherDTO)dto;
            string InsertSql = "INSERT INTO Publisher(PublisherName) VALUES('{0}')";
            return String.Format(InsertSql, _PublisherDTO.PublisherID);
        }

        public override string UpdateString(TransferObject dto)
        {
            _PublisherDTO = (PublisherDTO)dto;
            string UpdateSql = "UPDATE Publisher SET PublisherName='0' WHERE PublisherID = {1})";
            return String.Format(UpdateSql, _PublisherDTO.PublishName,_PublisherDTO.PublisherID);
        }

        public override string DeleteString(TransferObject dto)
        {
            _PublisherDTO = (PublisherDTO)dto;
            string DeleteSql = "DELETE FROM Publisher WHERE PublisherID = {0}";
            return String.Format(DeleteSql, _PublisherDTO.PublisherID);
        }

        protected override object GetDataFromDataRow(System.Data.DataTable dt, int i)
        {
            throw new NotImplementedException();
        }
    }
}
